const express = require('express');
const proxy = require('http-proxy-middleware');//引入代理中间件
const app = express();
app.use(express.static('hcloud-ui'));

//网关服务器地址和端口
const host = 'http://localhost:9999/';

//将服务器代理
const appProxy = proxy(
    '/', {
        target: host,
        changeOrigin: true,
        pathRewrite: {
            '^/': '/'
        }
    });
app.use('/', appProxy);

// Render your site
app.get('/index.htm', function (req, res) {
    res.sendFile(__dirname + '/index.html');
});

//对外访问的端口
app.listen(80, () => {
    console.log('Listening on: http://localhost:80');
});


//运行命令 npm install  ;   npm run dev ;